#ifndef	__TASK_SHELL_H
#define	__TASK_SHELL_H	

#include <CoOS.h>			 			/*!< CooCox RTOS header file.		  */
#include "shell_config.h"

typedef uint32_t param_t;

typedef void (*CMD_HANDLE)(uint8_t channel, param_t param);

typedef enum __INIT_EVENT
{
	IE_INIT,
	IE_EXIT,
} INIT_EVENT;

typedef void (*INIT_EXIT_FUNC)(INIT_EVENT event);

typedef char (*GET_CHAR)(void);

typedef struct _CMD_DEF
{
	char		m_cmd[CMD_LENGTH+1];
	uint8_t		m_param_size;
	CMD_HANDLE	m_handle;
} CMD_DEF, *PCMD_DEF;

typedef struct _SHELL_CREATE_CONTEXT
{
	GET_CHAR			m_get_ch_func;
	INIT_EXIT_FUNC 		m_init_func;
	CMD_DEF *			m_cmd_tab;
} SHELL_CREATE_CONTEXT, *PSHELL_CREATE_CONTEXT;

// !! This function cannot be called in IRQ
extern OS_TID create_shell(SHELL_CREATE_CONTEXT * context);

#endif	//__TASK_SHELL_H

